// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "ReadCVSFile.generated.h"

/**
 * 
 */

USTRUCT(BlueprintType)
struct FMyStruct
{
    GENERATED_BODY()

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "My Data")
    FString Name;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "My Data")
    int32 Age;
};

UCLASS()
class READCVS_API UReadCVSFile : public UObject
{
	GENERATED_BODY()
	
public:

    UFUNCTION(BlueprintCallable, Category = "My Data")
    TArray<FMyStruct> ReadCsv(const FString& FilePath);

private:
    TArray<FString> CsvLinesToArray(const FString& CsvLine);
    FString GetValueFromCsvLine(const FString& CsvLine, int32 Index);
};
